//查询合同页面
var methods = {
	//page{method:funciton(){}} 
	//设置一个合同到后台
	Contract:{
		objKey:"CurrentContractConfirm",
		errorListKey:"CurrentContractConfirmErrors",
		showImportKey:"ShowContractImport",
		waitConfirmTimeKey:"ContractWaitConfirmTime",
		SetContractInfo:function(req,call){
			//设置确认收款信息
			setStorage(this.objKey,req.obj);
			call(getRespData(400,"设置成功"));
		},
		clearContractInfo:function(req,call){
			//设置确认收款信息
			setStorage(this.objKey,undefined);
			call(getRespData(400,"清除成功"));
		},
		GetContractInfo:function(req,call){
			//设置确认收款信息
			call(getRespData(400,"获取成功",getStorage(this.objKey)));
		},
		//添加确认合同付款的错误列表
		AddContractError:function(req,call){
			var list = getStorage(this.errorListKey);
			list.push(req.obj);
			setStorage(this.errorListKey,list);
			call(getRespData(400,"添加成功",getStorage(this.errorListKey)));
		},
		//清空确认合同付款的错误列表
		ClearContractError:function(req,call){
			setStorage(this.errorListKey,[]);
			call(getRespData(400,"清除成功"));
		},
		//获取确认合同付款的错误列表
		GetContractError:function(req,call){
			call(getRespData(400,"获取成功",getStorage(this.errorListKey)));
		},
		GetShowContractImport:function(req,call){
			call(getRespData(400,"获取成功",getStorage(this.showImportKey)));
		},
		GetContractWaitConfirmTime:function(req,call){
			call(getRespData(400,"获取成功",getStorage(this.waitConfirmTimeKey)));
		}
	}
}

function getRespData(code,msg,obj){
	return {code:code,msg:msg,obj:obj};
}
function getStorage(key){
	var value = localStorage[key];
	if(value!=""){
		return $.parseJSON(value);
	}else{
		return undefined;
	}
}
function setStorage(key,value){
	if(value==undefined){
		localStorage[key] = "";
	}else{
		localStorage[key] = JSON.stringify(value);
	}
}